﻿Imports System.Data.SqlClient

Public Class Form1
  Private Sub Form1_Load(
        ByVal sender As Object,
        ByVal e As System.EventArgs) _
        Handles Me.Load
    Me.SqlConnection1.ConnectionString =
      "Integrated Security=SSPI;" &
      "Persist Security Info=False;" &
      "User ID='';" &
      "Initial Catalog=03_Customers_and_Orders;" &
      "Data Source=(local);" &
      "Initial File Name=''"
  End Sub

  Private Sub btnInserisciRecord_Click(
        ByVal sender As System.Object,
        ByVal e As System.EventArgs) _
        Handles btnInserisciRecord.Click
    Dim SQL As String =
      "INSERT INTO " &
        "[03_Customers_and_Orders].[dbo].[Customers] " &
        "([first_name], " &
        "[middle_name], " &
        "[last_name], " &
        "[customer_phone], " &
        "[customer_email], " &
        "[other_customer_details]) " &
      "VALUES(" &
        "'Mario', " &
        "'', " &
        "'De Ghetto', " &
        "'99999999', " &
        "'mario@deghetto.it', " &
        "'')"
    Me.SqlConnection1.Open()
    Dim Comando As New SqlCommand(
      SQL, Me.SqlConnection1)
    Dim Numero As Integer =
      Comando.ExecuteNonQuery
    Me.SqlConnection1.Close()
    Me.Label1.Text = "Inserimento eseguito!"
  End Sub
End Class
